package net.xinqushi.pthread.pthread;

/**
 * thread interrupt只是修改isInterrupted状态，并没有真正中断线程
 *
 *  @see Thread#interrupt()
 */
public class ThreadInterruptTest {

    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            while (!Thread.currentThread().isInterrupted()) {
                System.out.println("fuck man");
            }
        });thread.start();
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread.interrupt();
    }
}
